import pymysql
conn =pymysql.connect(
    host ='127.0.0.1',
    user = 'deng',
    password ='7112',
    database ='learn',
    charset ='utf8'
)
cursor =conn.cursor()  #获取一个光标
sql ='insert into Mysqllearn (title) values (%s);'
 
name = 'wuli'
pwd = 'now()'
cursor.execute(sql, [name])
conn.commit()
cursor.close()
conn.close()
